﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:bme="clr-namespace:BlendModeEffectLibrary;assembly=SLBlendModeEffectLibrary"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
	xmlns:local="clr-namespace:SLTestHarness"
	x:Class="SLTestHarness.MainPage"	
	mc:Ignorable="d"
>
	<UserControl.Resources>
		<ImageBrush
			x:Key="bGradientImageBrush"
			ImageSource="Resources/WhiteToBlackB.png"
		/>
		<ImageBrush
			x:Key="bImageImageBrush"
			ImageSource="Resources/fall_325x244.jpg"
		/>
		<local:FormattingConverter x:Key="formattingConverter"/>
	</UserControl.Resources>

	<Grid>
		<controls:TabControl>
			<controls:TabItem Header="Linear Burn Test Harness">
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>

					<StackPanel Grid.Column="1" Margin="10">
						<TextBlock Text="LINEAR BURN" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060"/>
						<Border
							Width="300"
							Height="100"
							Margin="0,10"
							Background="#FF6AB400"
						>
							<TextBlock Text="A" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060" VerticalAlignment="Center"/>
						</Border>
						<TextBlock Text="+" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060"/>
						<Border
							Width="300"
							Height="100"
							Margin="0,10"
						>
							<Border.Background>
								<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
									<GradientStop Color="#FFFFFFFF" Offset="0"/>
									<GradientStop Color="#FF808080" Offset="1"/>
								</LinearGradientBrush>
							</Border.Background>
							<TextBlock Text="B" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060" VerticalAlignment="Center"/>
						</Border>
						<TextBlock Text="=" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060"/>
						<Border
							Width="300"
							Height="100"
							Margin="0,10"
							Background="#FF6AB400"
						>
							<Border.Effect>
								<bme:LinearBurnEffect>
									<bme:LinearBurnEffect.BInput>
										<ImageBrush ImageSource="Resources/WhiteToGrayGradient.png"/>
									</bme:LinearBurnEffect.BInput>
								</bme:LinearBurnEffect>
							</Border.Effect>
							<TextBlock Text="R" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060" VerticalAlignment="Center"/>
						</Border>
					</StackPanel>
					<StackPanel Margin="10" Grid.Column="0">
						<TextBlock Text="OPACITY OVERLAY" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060"/>
						<Border
							Width="300"
							Height="100"
							Margin="0,10"
							Background="#FF6AB400"
						>
							<TextBlock Text="A" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF606060"/>
						</Border>
						<TextBlock Text="+" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060"/>
						<Border
							Width="300"
							Height="100"
							Margin="0,10"
						>
							<Border.Background>
								<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
									<GradientStop Color="#FFFFFFFF" Offset="0"/>
									<GradientStop Color="#FF808080" Offset="1"/>
								</LinearGradientBrush>
							</Border.Background>
							<TextBlock Text="B" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060" VerticalAlignment="Center"/>
						</Border>
						<TextBlock Text="=" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060"/>
						<Border
							Grid.Column="0"
							Width="300"
							Height="100"
							Margin="0,10"
							Background="#FF6AB400"
						>
							<Border>
								<Border.Background>
									<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
										<GradientStop Color="#7FFFFFFF" Offset="0"/>
										<GradientStop Color="#7F808080" Offset="1"/>
									</LinearGradientBrush>
								</Border.Background>
								<TextBlock Text="R" TextWrapping="Wrap" FontFamily="Verdana" FontSize="24" HorizontalAlignment="Center" Foreground="#FF606060" VerticalAlignment="Center"/>
							</Border>
						</Border>
					</StackPanel>
				</Grid>
			</controls:TabItem>

			<controls:TabItem Header="Gradient Test Harness">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto"/>
						<RowDefinition Height="210"/>
						<RowDefinition Height="*"/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>

					<TextBlock
						Grid.Row="0"
						Grid.Column="0"
						HorizontalAlignment="Center"
						Margin="5"
						FontFamily="Verdana"
						FontSize="24"
						Text="A"
					/>
					<TextBlock
						Grid.Row="0"
						Grid.Column="1"
						HorizontalAlignment="Center"
						Margin="5"
						FontFamily="Verdana"
						FontSize="24"
						Text="B"
					/>
					<TextBlock
						Grid.Row="0"
						Grid.Column="2"
						HorizontalAlignment="Center"
						Margin="5"
						FontFamily="Verdana"
						FontSize="24"
						Text="R"
					/>

					<Border
						x:Name="aBorder"
						Grid.Row="1"
						Grid.Column="0"
						Width="200"
						Height="200"
					>
						<Border.Background>
							<ImageBrush ImageSource="Resources/WhiteToBlackA.png"/>
						</Border.Background>
					</Border>
					<Border
						x:Name="bBorder"
						Grid.Row="1"
						Grid.Column="1"
						Width="200"
						Height="200"
					>
						<Border.Background>
							<ImageBrush ImageSource="Resources/WhiteToBlackB.png"/>
						</Border.Background>
					</Border>
					<Border
						x:Name="resultBorder"
						Grid.Row="1"
						Grid.Column="2"
						Width="200"
						Height="200"
						Opacity="{Binding ElementName=aGradientOpacitySlider, Path=Value}"
					>
						<Border.Background>
							<ImageBrush ImageSource="Resources/WhiteToBlackA.png"/>
						</Border.Background>
						<Border.Effect>
							<bme:NormalEffect BInput="{StaticResource bGradientImageBrush}"/>
						</Border.Effect>
					</Border>

					<StackPanel
						Grid.Row="2"
						Grid.Column="0"
						Orientation="Vertical"
					>
						<StackPanel
							Orientation="Horizontal"
							HorizontalAlignment="Center"
							VerticalAlignment="Top"
							Margin="10"
						>
							<TextBlock
								Text="Opacity"
								VerticalAlignment="Center"
								Foreground="DarkBlue"
							/>
							<Slider
								x:Name="aGradientOpacitySlider"
								Width="150"
								Margin="5"
								Minimum="0"
								Maximum="1"
								SmallChange="0.1"
								LargeChange="0.2"
								Value="1"
							/>
							<TextBlock
								Text="{Binding ElementName=aGradientOpacitySlider, Path=Value, Converter={StaticResource formattingConverter}, ConverterParameter=F2}"
								VerticalAlignment="Center"
							/>
						</StackPanel>
					</StackPanel>
					<StackPanel
						Grid.Row="2"
						Grid.Column="1"
						Orientation="Vertical"
					>
						<StackPanel
							Orientation="Horizontal"
							HorizontalAlignment="Center"
							VerticalAlignment="Top"
							Margin="10"
						>
							<TextBlock
								Text="Opacity"
								VerticalAlignment="Center"
								Foreground="DarkBlue"
							/>
							<Slider
								x:Name="bGradientOpacitySlider"
								Width="150"
								Margin="5"
								Minimum="0"
								Maximum="1"
								SmallChange="0.1"
								LargeChange="0.2"
								Value="1"
							/>
							<TextBlock
								Text="{Binding ElementName=bGradientOpacitySlider, Path=Value, Converter={StaticResource formattingConverter}, ConverterParameter=F2}"
								VerticalAlignment="Center"
							/>
						</StackPanel>
					</StackPanel>

					<ListBox
						x:Name="gradientEffectsListBox"
						Grid.Row="2"
						Grid.Column="2"
						Margin="30,10"
						SelectionChanged="effectsListBox_SelectionChanged"
					/>
				</Grid>
			</controls:TabItem>

			<controls:TabItem Header="Image Test Harness">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto"/>
						<RowDefinition Height="250"/>
						<RowDefinition Height="*"/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>

					<TextBlock
						Grid.Row="0"
						Grid.Column="0"
						HorizontalAlignment="Center"
						Margin="5"
						FontFamily="Verdana"
						FontSize="24"
						Text="A"
					/>
					<TextBlock
						Grid.Row="0"
						Grid.Column="1"
						HorizontalAlignment="Center"
						Margin="5"
						FontFamily="Verdana"
						FontSize="24"
						Text="B"
					/>
					<TextBlock
						Grid.Row="0"
						Grid.Column="2"
						HorizontalAlignment="Center"
						Margin="5"
						FontFamily="Verdana"
						FontSize="24"
						Text="R"
					/>

					<Image
						x:Name="aImage"
						Grid.Row="1"
						Grid.Column="0"
						Width="325"
						Height="244"
						Source="Resources/summer_325x244.jpg"
					/>
					<Image
						x:Name="bImage"
						Grid.Row="1"
						Grid.Column="1"
						Width="325"
						Height="244"
						Source="Resources/fall_325x244.jpg"
					/>
					<Image
						x:Name="rImage"
						Grid.Row="1"
						Grid.Column="2"
						Width="325"
						Height="244"
						Source="Resources/summer_325x244.jpg"
						Opacity="{Binding ElementName=aImageOpacitySlider, Path=Value}"
					>
						<Image.Effect>
							<bme:NormalEffect BInput="{StaticResource bImageImageBrush}"/>
						</Image.Effect>
					</Image>

					<StackPanel
						Grid.Row="2"
						Grid.Column="0"
						Orientation="Vertical"
					>
						<StackPanel
							Orientation="Horizontal"
							HorizontalAlignment="Center"
							VerticalAlignment="Top"
							Margin="10"
						>
							<TextBlock
								Text="Opacity"
								VerticalAlignment="Center"
								Foreground="DarkBlue"
							/>
							<Slider
								x:Name="aImageOpacitySlider"
								Width="150"
								Margin="5"
								Minimum="0"
								Maximum="1"
								SmallChange="0.1"
								LargeChange="0.2"
								Value="1"
							/>
							<TextBlock
								Text="{Binding ElementName=aImageOpacitySlider, Path=Value, Converter={StaticResource formattingConverter}, ConverterParameter=F2}"
								VerticalAlignment="Center"
							/>
						</StackPanel>
					</StackPanel>
					<StackPanel
						Grid.Row="2"
						Grid.Column="1"
						Orientation="Vertical"
					>
						<StackPanel
							Orientation="Horizontal"
							HorizontalAlignment="Center"
							VerticalAlignment="Top"
							Margin="10"
						>
							<TextBlock
								Text="Opacity"
								VerticalAlignment="Center"
								Foreground="DarkBlue"
							/>
							<Slider
								x:Name="bImageOpacitySlider"
								Width="150"
								Margin="5"
								Minimum="0"
								Maximum="1"
								SmallChange="0.1"
								LargeChange="0.2"
								Value="1"
							/>
							<TextBlock
								Text="{Binding ElementName=bImageOpacitySlider, Path=Value, Converter={StaticResource formattingConverter}, ConverterParameter=F2}"
								VerticalAlignment="Center"
							/>
						</StackPanel>
					</StackPanel>

					<ListBox
						x:Name="imageEffectsListBox"
						Grid.Row="2"
						Grid.Column="2"
						Margin="30,10"
						SelectionChanged="imageEffectsListBox_SelectionChanged"
					/>
				</Grid>
			</controls:TabItem>
		</controls:TabControl>
	</Grid>
</UserControl>
